<?php (!defined('IN_SYSTEM') || !defined('ADMIN_PRE')) && exit('Access Denied!');?>
{admintemplate header}
<div class="box">
	<div class="heading">
	<h1>广告列表</h1>
	<div class="buttons">
	<a href="{url admin.php?m=adv&f=index}" class="fr">所有广告</a>
	<a href="{url admin.php?m=adv&f=add}" class="fr current">添加</a>
	</div>
	</div>
	<div class="main">
	<form name="save" method="post" action="?m=adv&f=add"  enctype="multipart/form-data">
	<input type="hidden" name="advsubmit" value="true" />
	<input type="hidden" name="id" value="{$id}" />
	<table width="100%" cellspacing="0" class="tb">
		<tr>
			<td colspan="2"><div id="tip"></div></td>
		</tr>
		<tr>
			<td  width="150"  align="right">{l('Title','adv')}({l('Required','adv')})：</td>
			<td><input type="text" name="adv[title]" value="{$adv['title']}" class="input" size="50" /> <span> 广告标题只为识别辨认不同广告条目之用，并不在广告中显示</span></td>
		</tr>
		</tr><tr>
			<td  width="150"  align="right">是否启用：</td>
			<td>
			<input type="radio"  {if $adv['inuse']}checked{/if} name="adv[inuse]" value="1" class="radio">&nbsp;启用&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio"   value="0" name="adv[inuse]" {if !$adv['inuse']}checked{/if} class="radio">&nbsp;禁用&nbsp;&nbsp;&nbsp;&nbsp;
			</td>
		</tr>
		<tr>
			<td  width="150"  align="right">显示顺序：</td>
			<td><input type="text" name="adv[displayorder]" value="{$adv['displayorder']}" class="input" size="50" /> <span> </span></td>
		</tr>
		<tr>
			<td  width="150"  align="right">广告起始时间(选填)：</td>
			<td><input type="text" name="adv[starttime]" value="{if $adv['starttime']>0}{gdate('Y-m-d',$adv['starttime'])}{/if}" class="input" size="20"  onclick="showcalendar(event);"  /> <span>设置广告起始生效的时间，格式 yyyy-mm-dd，留空为不限制起始时间</span></td>
		</tr><tr>
			<td  width="150"  align="right">广告结束时间(选填)：</td>
			<td><input type="text" name="adv[endtime]" value="{if $adv['endtime']>0}{gdate('Y-m-d',$adv['endtime'])}{/if}" class="input" size="20"  onclick="showcalendar(event);"  /> <span>设置广告起始生效的时间，格式 yyyy-mm-dd，留空为不限制起始时间</span></td>
		</tr>
		</tr><tr>
			<td  width="150"  align="right">展现方式：</td>
			<td>
			<input type="radio" onclick="styleshow('code')" value="code" {if $adv['content']['type']=='code'}checked{/if} name="adv[type]" class="radio">&nbsp;代码&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" onclick="styleshow('text')" value="text" name="adv[type]" {if $adv['content']['type']=='text'}checked{/if} class="radio">&nbsp;文字&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" onclick="styleshow('image')" value="image" {if $adv['content']['type']=='image'}checked{/if}  name="adv[type]" class="radio">&nbsp;图片&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" onclick="styleshow('flash')" value="flash" {if $adv['content']['type']=='flash'}checked{/if}  name="adv[type]" class="radio">&nbsp;Flash
			</td>
		</tr>
		<tbody id="style_code">
		<tr>
			<td  width="150"  align="right">广告 HTML 代码：</td>
			<td><textarea name="adv[code][html]" cols="50" rows="5">{$adv['content']['html']}</textarea>
			</td>
		</tr>
		</tbody>
		<tbody id="style_text">
		<tr>
			<td  width="150"  align="right">文字内容：</td>
			<td><input type="text" name="adv[text][title]" value="{$adv['content']['title']}" class="input" size="50"  /> <span></span></td>
		</tr><tr>
			<td  width="150"  align="right">文字链接：</td>
			<td><input type="text" name="adv[text][link]" value="{$adv['content']['link']}" class="input" size="50"  /> <span></span></td>
		</tr>
		</tbody>
		<tbody id="style_image">
		<tr>
			<td  width="150"  align="right">图片地址：</td>
			<td><input type="file" name="tmpadvimage"  id="advimg0" style="display:none;"/> <input type="text" name="advimage" value="{$adv['content']['url']}" class="input" size="50"    id="advimg1"/> <span></span><br/>
			<a href="javascript:;" id="advimg0a"  onclick="$('#advimg0').attr('name','advimage').show();$('#advimg1').attr('name','tmpadvimage').hide();$('#advimg1a').css('font-weight','normal');$('#advimg0a').css('font-weight','bold');">上传文件</a>&nbsp;&nbsp;
			<a href="javascript:;" id="advimg1a"   onclick="$('#advimg1').attr('name','advimage').show();$('#advimg0').attr('name','tmpadvimage').hide();$('#advimg0a').css('font-weight','normal');$('#advimg1a').css('font-weight','bold');">输入图片地址</a></td>
		</tr><tr>
			<td  width="150"  align="right">图片链接：</td>
			<td><input type="text" name="adv[image][link]" value="{$adv['content']['link']}" class="input" size="50"  /> <span></span></td>
		</tr><tr>
			<td  width="150"  align="right">图片描述：</td>
			<td><input type="text" name="adv[image][alt]" value="{$adv['content']['alt']}" class="input" size="50"  /> <span></span></td>
		</tr><tr>
			<td  width="150"  align="right">图片宽度：</td>
			<td><input type="text" name="adv[image][width]" value="{$adv['content']['width']}" class="input" size="50"  /> <span></span></td>
		</tr><tr>
			<td  width="150"  align="right">图片高度：</td>
			<td><input type="text" name="adv[image][height]" value="{$adv['content']['height']}" class="input" size="50"  /> <span></span></td>
		</tr>
		</tbody>
		<tbody id="style_flash">
		<tr>
			<td  width="150"  align="right">Flash地址：</td>
			<td><input type="file" name="tmpadvflash"  id="advflash0" style="display:none;"/> <input type="text" name="advflash" value="{$adv['content']['url']}" class="input" size="50"    id="advflash1"/> <span></span><br/>
			<a href="javascript:;" id="advflash0a"  onclick="$('#advflash0').attr('name','advflash').show();$('#advflash1').attr('name','tmpadvflash').hide();$('#advflash1a').css('font-weight','normal');$('#advflash0a').css('font-weight','bold');">上传文件</a>&nbsp;&nbsp;
			<a href="javascript:;" id="advflash1a"   onclick="$('#advflash1').attr('name','advflash').show();$('#advflash0').attr('name','tmpadvflash').hide();$('#advflash0a').css('font-weight','normal');$('#advflash1a').css('font-weight','bold');">输入Flash地址</a></td>
		</tr><tr>
			<td  width="150"  align="right">Flash宽度：</td>
			<td><input type="text" name="adv[flash][width]" value="{$adv['content']['width']}" class="input" size="50"  /> <span></span></td>
		</tr><tr>
			<td  width="150"  align="right">Flash高度：</td>
			<td><input type="text" name="adv[flash][height]" value="{$adv['content']['height']}" class="input" size="50"  /> <span></span></td>
		</tr>
		</tbody>
		<tr class="bg2"><td></td><td><input type="submit" class="button" value="{l('Submit','adv')}" /></td></tr>
	</table>
	</form>
		<script type="text/javascript">
		function styleshow(id){
			$('#style_code').hide();
			$('#style_text').hide();
			$('#style_image').hide();
			$('#style_flash').hide();
			if(id)$('#style_'+id).show();
		}
		styleshow('{$adv[content][type]}');
		</script>
		{script('calendar.js')}
	</div>
</div>
{admintemplate footer}